package com.zy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.messaging.Message;

import java.util.function.Consumer;

@SpringBootApplication
public class Demo06Application {

    public static void main(String[] args) {
        SpringApplication.run(Demo06Application.class, args);
    }

    // Bean名称"stefanie"必须和配置文件"function.definition"保持一致
    @Bean
    public Consumer<Message<String>> stefanie() {
        return stringMessage -> {
            System.out.println(System.currentTimeMillis() + "接收到消息：" + stringMessage.getPayload());
        };
    }
}
